/*
 * AGameObject.hpp
 *
 *  Created on: 18/05/2009
 *      Author: desadoc
 */

#ifndef AGAMEOBJECT_HPP_
#define AGAMEOBJECT_HPP_

#include <map>

#ifndef _NO_NAMESPACE
namespace lib2Desa {
#endif

class AGameObject : public IGameObject
{
	//class

protected:

	std::map<const std::string, shared_ptr<Animation> > ani;
	std::list<u16> enabled;
	vector2f dim;

public:

	AGameObject(const shared_ptr<GameObject>& parent = null, const vector2f& pos = vector2f()) : GameElement(parent, pos)
	{
		// TODO
		u32 i = 0;
		for(; i< animations.size(); i++)
		{
			animations[i] = null;
		}
	}

	virtual ~AGameObject(void);

	virtual void draw(const shared_ptr<IGraphicDevice>& gs) const;
	virtual bool run(u32 ml);

	virtual void setAnimation(u16 index, const shared_ptr<Animation>& ani);
	virtual shared_ptr<Animation> getAnimation(u16 index) const;
	virtual void enableAnimation(u16 index, bool enable);

	virtual void notify(shared_ptr<IEvent> e);

	void setDimension(const vector2f& d)
	{
		dim = d;
	}

	const Rect getRect(void) const
	{
		return Rect(getAbsPos(), dim);
	}
};

#ifndef _NO_NAMESPACE
}
#endif

#endif /* AGAMEOBJECT_HPP_ */
